﻿using System;
using System.Data;
using System.Data.SqlClient;
using System.Windows.Forms;

namespace HenhouseEnvironmentCtrl
{
    public partial class HistoryWarningDataForm : Form
    {
        public HistoryWarningDataForm()
        {
            InitializeComponent();
        }

        private void HistoryWarningDataForm_Load(object sender, EventArgs e)
        {
            LoadWarningData();
        }

        private void LoadWarningData()
        {
            using (SqlConnection conn = DBConnection.CreateConnection())
            {
                
                SqlDataAdapter sda = new SqlDataAdapter("SELECT * FROM warnrecord", conn);
                DataTable dt = new DataTable();
                sda.Fill(dt);
                dgvWarningData.DataSource = dt;
               
            }
        }

        private void BtnBack_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
